<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" href="css/home.css">
		<link rel="stylesheet" href="css/base.css">
		<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
		<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<script type="text/javascript" src="js/setting.js"></script>
		<script type="text/javascript" src="js/userUrl.js"></script>
		<script type="text/javascript" src="js/personInfro.js"></script>
		<title>舆情定制</title>
		<style>
			body{
				background: #f5f3f3;
			}
		</style>
	</head>

	<body>
		<div class="wholePublic-box">
			<div class="wholePublic-header clearfix">
				<div class="wholePublic-logo fl">
					<a href="index-logged.html"><img src="images/logo-2.png" /></a>
				</div>
				<div class="wholePublic-header-list fl">
					<ul class="clearfix">
						<li onclick="wholePublic()">全部舆情</li>
						<li class="wholePublic-border" onclick="myCustom">舆情定制</li>
						<li onclick="analy()">分析报告</li>
						<li onclick="thinkTank()">智库</li>
						<li onclick="contactUs()">联系我们</li>
					</ul>
				</div>
				<div class="wholePublic-header-right fr">
					<ul class="clearfix">
						<li id="line"><img src="images/line-2.png" /></li>
						<li onclick="javascript:window.location='my-custom.html'">我的定制</li>
						<li id="exit"><img src="images/exit-2.png" /></li>
						<li class="setting-icon">
							<a href="company-setting.html"><img src="images/setting-icon.png" /></a>
						</li>
					</ul>
				</div>
			</div>
			<div class="grcolor-box"></div>
			<div class="wholePublic-mainBody clearfix">
				<div class="wholePublic-leftContent wholePublic wholePublic-part2 fl" id="col1">
					<ul>
						<li class="wholePublic-selected" onclick="myCustom()"><img src="images/my-custom-icon-selected.png" /><span>我的定制</span></li>
						<li onclick="customSet()"><img src="images/custom-icon.png" /><span>定制设置</span></a>
						</li>
						<li onclick="warnCustom()"><img src="images/warning-icon.png" /><span>预警推送</span></li>
					</ul>
				</div>
				<div class="wholePublic-rightContent fl" id="colRight">
					<!--我的定制-->
					<div class="personal-tailor clearfix">
						<div class="personal-tailor-item">
							<div class="delect-icon"><img src="images/delect-icon.png" /></div>
							<div class="personal-tailor-header">
								<!--<span><img src="images/signal-lamp.png" class="signal-lamp"/></span>-->
								<span>1马云xxx</span>
								<span class="line-3"><img src="images/line-3.png"/></span>
								<span>共233434篇</span>
							</div>
							<div class="clearfix personal-content daily">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content daily">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content daily">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content daily">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content daily">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<button></button>
						</div>
						<div class="personal-tailor-item">
							<div class="delect-icon"><img src="images/delect-icon.png" /></div>
							<div class="personal-tailor-header">
								<!--<span><img src="images/signal-lamp.png" class="signal-lamp"/></span>-->
								<span>2马云xxx</span>
								<span class="line-3"><img src="images/line-3.png"/></span>
								<span>共233434篇</span>
							</div>
							<div class="clearfix personal-content danger">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content danger">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content danger">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content danger">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content danger">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<button></button>
						</div>
						<div class="personal-tailor-item">
							<div class="delect-icon"><img src="images/delect-icon.png" /></div>
							<div class="personal-tailor-header">
								<span><img src="images/signal-lamp.png" class="signal-lamp"/></span>
								<span>3马云xxx</span>
								<span class="line-3"><img src="images/line-3.png"/></span>
								<span>共233434篇</span>
							</div>
							<div class="clearfix personal-content defined">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content defined">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content defined">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content defined">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<div class="clearfix personal-content defined">
								<div class="fl">马云科技出版青少年IT教育书籍，培养人才从小抓起</div>
								<div class="fr grcolor">2018-3-25</div>
							</div>
							<button></button>
						</div>

						<div class="personal-tailor-item add-box">
							<a href="custom-setting.html" class="add-icon"><img src="images/add-icon.png" /></a>
						</div>
					</div>

				</div>
			</div>
		</div>
		<div id="mask"></div>
		<div class="confirm-box">
			<div class="confirm-del"><img src="images/delect-icon.png" /></div>
			<div class="confirm-title">删除定制</div>
			<div>您确定要删除此内容吗？</div>
			<div class="clearfix">
				<button class="fl confirm-btn">确定</button>
				<button class="fr cancel-btn">取消</button>
			</div>
		</div>
	</body>

</html>
<script>
	var token = sessionStorage.getItem('token');
	console.log(token);

	var useraccount = JSON.parse(token).useraccount;
	var userid = JSON.parse(token).id;
	console.log(userid)

	Resize = function() {
		var doc = document.documentElement;
		relHeight = (doc.clientHeight > doc.scrollHeight) ? doc.clientHeight : doc.scrollHeight; //获取屏幕高度和当前页面高度中的较大值  
		document.getElementById('col1').style.height = relHeight - 82 + 'px'; //id为bg的div就是我页面中的遮罩层
	};
	Resize();
	
	//删除一条我的定制
	var id;
	$(".delect-icon").click(function() {
		var index = $(this).parent(".personal-tailor-item").index();
		id = index + 1;
		$("#mask").show();
		$(".confirm-box").show();
		if($(".confirm-btn").click(function() {
				$("#mask").hide();
				$(".confirm-box").hide();
				console.log(ids)
				$(".personal-tailor-item").eq(index).remove();
				delDaily();
				deldanger();
				deldefined();
			}));
		if($(".cancel-btn").click(function() {
				$("#mask").hide();
				$(".confirm-box").hide();
				
			}));
		if($(".confirm-del").click(function(){
				$("#mask").hide();
				$(".confirm-box").hide();
			}));
		
	});

	//点击进入详情
	$(".personal-tailor-item").not(".add-box").click(function(){
		window.location.href="customDetail.html";
	});
	
	//删除日常定制舆情
	function delDaily() {
		var data = {
			'id': id,
		};
		$.ajax({
			type: "get",
			url: 'http://139.224.208.224:8080/qi-radar/diySensa/delDailySen',
			dataType: 'json',
			contentType: "application/json ",
			headers: {
				"Authorization": token
			},
			asycn: false,
			data: data,
			success: function(data) {
				if(data.code == 0) {
					var data = data.data;
					console.log(data)
				} else {
					alert(data.errMsg)
				};
			}
		});
	};
	
	//删除危机定制舆情
	function deldanger() {
		var data = {
			'id': 2,
		};
		$.ajax({
			type: "get",
			url: 'http://139.224.208.224:8080/qi-radar/diySensa/delCrisisSen',
			dataType: 'json',
			contentType: "application/json ",
			headers: {
				"Authorization": token
			},
			asycn: false,
			data: data,
			success: function(data) {
				if(data.code == 0) {
					var data = data.data;
					console.log(data)
				} else {
					alert(data.errMsg)
				};
			}
		});
	};
	
	//删除自定义监测舆情
	function deldefined() {
		var data = {
			'id': 3,
		};
		$.ajax({
			type: "get",
			url: 'http://139.224.208.224:8080/qi-radar/diySensa/delMonitorSen',
			dataType: 'json',
			contentType: "application/json ",
			headers: {
				"Authorization": token
			},
			asycn: false,
			data: data,
			success: function(data) {
				if(data.code == 0) {
					var data = data.data;
//					console.log(data)
				} else {
					alert(data.errMsg)
				};
			}
		});
	};
	
	//已定制舆情内容
	getCustom()
	function getCustom() {
		var datas = {
			'id': 3,
			'type':1
		};
		var data=JSON.stringify(datas);
		$.ajax({
			type: "post",
			url: 'http://139.224.208.224:8080/qi-radar/diySensa/getCustomizatSen',
			dataType: 'json',
			contentType: "application/json ",
			headers: {
				"Authorization": token
			},
			asycn: false,
			data: data,
			success: function(data) {
				if(data.code == 0) {
					var data = data.data;
					var list="";
					console.log(data)
					var newTime="";
					var year="";
					var month="";
					var day="";
					var time="";
						newTime=new Date(data.cd_endtime)
						year=newTime.getFullYear();
						month=newTime.getMonth() + 1;
						day=newTime.getDate();
						time=(year + "-" + month + "-" + day);
						console.log(time);
						list+="<div class=\"fl\">"+data.cd_title+"</div>";
						list+="<div class=\"fr grcolor\">"+time+"</div>";
						$(".daily").html(list);
				} else {
					alert(data.errMsg)
				};
			}
		});
	};

	danger()
	function danger() {
		var datas = {
			'id': 3,
			'type':2
		};
		var data=JSON.stringify(datas);
		$.ajax({
			type: "post",
			url: 'http://139.224.208.224:8080/qi-radar/diySensa/getCustomizatSen',
			dataType: 'json',
			contentType: "application/json ",
			headers: {
				"Authorization": token
			},
			asycn: false,
			data: data,
			success: function(data) {
				if(data.code == 0) {
					var data = data.data;
					var list="";
					console.log(data)
					var newTime="";
					var year="";
					var month="";
					var day="";
					var time="";
						newTime=new Date(data.cc_endtime)
						year=newTime.getFullYear();
						month=newTime.getMonth() + 1;
						day=newTime.getDate();
						time=(year + "-" + month + "-" + day);
						console.log(time);
						list+="<div class=\"fl\">"+data.cc_title+"</div>";
						list+="<div class=\"fr grcolor\">"+time+"</div>";
						$(".danger").html(list);
				} else {
					alert(data.errMsg)
				};
			}
		});
	};
	
//	defined()
//	function defined() {
//		var datas = {
//			'id': 3,
//			'type':3
//		};
//		var data=JSON.stringify(datas);
//		$.ajax({
//			type: "post",
//			url: 'http://139.224.208.224:8080/qi-radar/diySensa/getCustomizatSen',
//			dataType: 'json',
//			contentType: "application/json ",
//			headers: {
//				"Authorization": token
//			},
//			asycn: false,
//			data: data,
//			success: function(data) {
//				if(data.code == 0) {
//					var data = data.data;
//					var list="";
//					console.log(data)
//					var newTime="";
//					var year="";
//					var month="";
//					var day="";
//					var time="";
//						newTime=new Date(data.cc_endtime)
//						year=newTime.getFullYear();
//						month=newTime.getMonth() + 1;
//						day=newTime.getDate();
//						time=(year + "-" + month + "-" + day);
//						console.log(time);
//						list+="<div class=\"fl\">"+data.cc_title+"</div>";
//						list+="<div class=\"fr grcolor\">"+time+"</div>";
//						$(".defined").html(list);
//				} else {
//					alert(data.errMsg)
//				};
//			}
//		});
//	};
</script>